package com.eastfair.mobile.controller;

import com.eastfair.builder.dto.ExhibitorDTO;
import com.eastfair.builder.vo.ExhibitorVO;
import com.eastfair.core.base.R;
import com.eastfair.mobile.service.MobileDataService;
import com.eastfair.venueservice.dto.ExhibitionManageQuery;
import com.eastfair.venueservice.dto.ServiceProviderCreditDTO;
import com.eastfair.venueservice.dto.ServiceProviderSpaceDTO;
import com.eastfair.venueservice.dto.ServiceProviderSpaceQuery;
import com.eastfair.venueservice.vo.ExhibitionManageVO;
import com.eastfair.venueservice.vo.ServiceProviderCreditVO;
import com.eastfair.venueservice.vo.ServiceProviderSpaceVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * <p>
 * 前端控制器
 * 鹰眼系统调用数据
 * </p>
 *
 * @author lyw
 * @date 2022-08-08
 */
@Slf4j
@Validated
@RestController
@RequestMapping("/mobileData")
@Api(value = "mobileData", tags = "鹰眼系统调用数据")
public class MobileDataController  {

    @Autowired
    private MobileDataService mobileDataService;

    /**
     * 查询展商VO列表.
     *
     * @param exhibitorDTO the exhibitor dto
     * @return the r
     */
    @ApiOperation("查询展商VO列表")
    @PostMapping("/queryExhibitors")
    public R<List<ExhibitorVO>> queryExhibitors(@RequestBody ExhibitorDTO exhibitorDTO) {
        List<ExhibitorVO> list= mobileDataService.queryExhibitors(exhibitorDTO);
        return R.success(list);
    }


    /**
     * 通过服务商查询进行中的展会
     *
     * @param exhibitionManageQuery 通过服务商查询进行中的展会
     * @return R
     */
    @PostMapping("/queryExhibitionManageByProvider")
    R<ExhibitionManageVO> queryExhibitionManageByProvider(@RequestBody ExhibitionManageQuery exhibitionManageQuery){
        ExhibitionManageVO exhibitionManageVO = mobileDataService.queryExhibitionManageByProvider(exhibitionManageQuery);
        return R.success(exhibitionManageVO);
    }


    /**
     * 查询服务商使用展厅
     *
     * @param serviceProviderSpaceQuery 查询服务商使用展厅
     * @return R
     */
    @ApiOperation(value = "查询服务商使用展厅", notes = "查询服务商使用展厅")
    @PostMapping("/queryServiceProviderSpace")
    public R<List<ServiceProviderSpaceVO>> queryServiceProviderSpace(@RequestBody ServiceProviderSpaceQuery serviceProviderSpaceQuery) {
        List<ServiceProviderSpaceVO>  spaceDTOList= mobileDataService.queryServiceProviderSpace(serviceProviderSpaceQuery);
        return R.success(spaceDTOList);
    }

    /**
     * 查询服务商星级分
     * @return
     */
    @ApiOperation(value = "查询服务商星级分")
    @GetMapping(value = "/getServiceProviderCreditById/{serviceProviderId}")
    public R<ServiceProviderCreditVO> getServiceProviderCreditById(@PathVariable Long serviceProviderId){

    return R.success(mobileDataService.getServiceProviderCreditById(serviceProviderId));

    }

    /**
     * 添加服务商信用星级分
     * @return
     */
    @ApiOperation(value = "添加服务商信用星级分")
    @PostMapping(value = "/saveServiceProviderCreditInfo")
    public R<Boolean> saveServiceProviderCreditInfo(@RequestBody ServiceProviderCreditDTO serviceProviderCreditDTO){

       return R.success(mobileDataService.saveServiceProviderCreditInfo(serviceProviderCreditDTO));


    }


}



